#include <stdio.h>

#include "tlib_ip_limit.h"

int main(int argc ,char *argv[])
{
	int iKey,iBlockIndex;
	char sErrMsg[200];
	int iRetCode;
	TLIB_IP_ACCESS_ENTRY *pstEntry;
	
	if (argc<3){
		printf("Usage %s key BlockIndex\n",argv[0]);
		return -1;
	}
	
	iKey=atoi(argv[1]);	
	if (iKey==0){
		printf("Invlalid key\n");
		return -1;
		
	}
	
	iBlockIndex=atoi(argv[2]);
	if ((iBlockIndex==0) || (iBlockIndex>C_MAX_BLOCK_NUM)){
		printf("Invlalid iBlockIndex\n");
		return -1;
	}
	
	iRetCode=TLib_IP_Limit_Init(iKey,10,10,10,0,sErrMsg);
	if (iRetCode!=0){
		printf("%s\n",sErrMsg);
		return -1;
	}	
		
	iRetCode=TLib_IP_Limit_ListBlockEntry(iBlockIndex,sErrMsg);
	if (iRetCode!=0){
		printf("%s\n",sErrMsg);
		return -1;
	}			
	
	return 0;
}